﻿// Original author contact info: Owen Emlen (owene_1998@yahoo.com)
// Note: other individuals may also have contributed to this code
// Project hosted on CodePlex.com as of 1/10/2009 at http://www.codeplex.com/EmlenMud
using System;
using System.Runtime.Serialization;
using System.ComponentModel;

namespace BrainTechLLC
{
    [Serializable]
#if NO_SILVERLIGHT
    [Browsable(true)]
    [TypeConverter(typeof(ExpandableObjectConverter))]
#endif
    [DataContract]
    public class PositionInt : LocationInt, IPositionInt, IHasLocationInt
    {
        protected DirectionInt _direction;
        public DirectionInt DirectionVector { get { if (_direction == null) _direction = new DirectionInt(); return _direction; } set { _direction = value as DirectionInt; } }
        public LocationInt LocationInt { get { return this; } }
        public GeneralDirection CardinalDirection { get { return DirectionVector.CardinalDirection; } }
        public DirectionInt GetSymmetric(Symmetry symmetry) { return DirectionVector.GetSymmetric(symmetry); }

        public PositionInt() { }
        public PositionInt(LocationInt location) : base(location) { }
        public PositionInt(LocationInt location, DirectionInt dir) : base(location) { _direction = new DirectionInt(dir); }
        public PositionInt(PositionInt p) : this(p.LocationInt as LocationInt, p._direction) { }
    }

}
